using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Decisions.HL7.Message;
using DecisionsFramework;

namespace Decisions.HL7.Message
{
    public class TQConjunctionIDAttribute:RuleAttribute
    {
        private Dictionary<HL7Version, string[]> validVersionCodes = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, string[]> validVersionDescriptions = new Dictionary<HL7Version, string[]>();
        private Dictionary<HL7Version, HL7TableType> tableVersionTypes = new Dictionary<HL7Version, HL7TableType>();

        public TQConjunctionIDAttribute()
        {
            // init the values for table version types
						tableVersionTypes[HL7Version.v24] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v25] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v251] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v26] = HL7TableType.HL7;
						tableVersionTypes[HL7Version.v27] = HL7TableType.HL7;
			
            
			// init the values for version codes
						validVersionCodes[HL7Version.v24] = new string[]{"S","A","C"};
						validVersionCodes[HL7Version.v25] = new string[]{"S","A","C"};
						validVersionCodes[HL7Version.v251] = new string[]{"S","A","C"};
						validVersionCodes[HL7Version.v26] = new string[]{"S","A","C"};
						validVersionCodes[HL7Version.v27] = new string[]{"S","A","C"};
			
			// init the values for version descriptions
						validVersionDescriptions[HL7Version.v24] = new string[]{"Synchronous. Do the next specification after this one (unless otherwise constrained by the following components: ORC-7^4-start date/time and ORC-7^5-end date/time). An \"S\" specification implies that the second timing sequence follows the first, e.g., when","Asynchronous: Do the next specification in parallel with this one (unless otherwise constrained by the following components: ORC-7^4-start date/time and ORC-7^5-end date/time).  The conjunction of \"A\" specifies two parallel instructions, as are sometimes","This is an actuation time.  It will be followed by a completion time for the service.  This code allows one to distinguish between the time and priority at which a service should be actuated (e.g., blood should be drawn) and the time and priority at which"};
						validVersionDescriptions[HL7Version.v25] = new string[]{"Synchronous.","Asynchronous","This is an actuation time"};
						validVersionDescriptions[HL7Version.v251] = new string[]{"Synchronous","Asynchronous","Actuation Time"};
						validVersionDescriptions[HL7Version.v26] = new string[]{"Synchronous","Asynchronous","Actuation Time"};
						validVersionDescriptions[HL7Version.v27] = new string[]{"Synchronous","Asynchronous","Actuation Time"};
			            

        }

        
        public override ValidationIssue[] RunRule(string name, object owningObject, object value)
        {
            //todo: check if the value is valid in the current version
            //if the value is not valid in the current version, add it as a validation issue


            return new ValidationIssue[0];
        }
    }
}
